load("//tools/build_defs/android:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")
load("//tools/build_defs/oss:profilo_defs.bzl", "profilo_path")

fb_xplat_cxx_library(
    name = "atrace",
    srcs = [
        "Atrace.cpp",
        "jni.cpp",
    ],
    headers = glob(
        ["*.h"],
    ),
    header_namespace = "profilo/atrace",
    allow_jni_merging = True,
    compiler_flags = [
        "-fexceptions",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo/atrace\"",
    ],
    soname = "libprofilo_atrace.$(ext)",
    supported_platforms_regex = "^android-(armv7|arm64|x86)$",
    visibility = [
        profilo_path("..."),
        "//perftests/benchmarks/java/com/facebook/benchmarks/profilo/...",
    ],
    deps = [
        profilo_path("cpp:constants"),
        profilo_path("cpp:profilo"),
        profilo_path("cpp/logger:logger"),
        profilo_path("cpp/sigmuxsetup:sigmuxsetup"),
        profilo_path("deps/atomic:atomic"),
        profilo_path("deps/fb:fb"),
        profilo_path("deps/fbjni:fbjni"),
        profilo_path("deps/linker:linker"),
        profilo_path("deps/sigmux:sigmux"),
        profilo_path("cpp/util:hooks"),
        profilo_path("deps/breakpad:abort-with-reason"),
    ],
)
